﻿using MahApps.Metro.IconPacks;
using System;
using System.Globalization;
using System.Windows.Data;

namespace FunasrSTT.Translate.Converters;

/// <summary>
/// 对话框类型转换成图标.
/// </summary>
public class DialogKindToIconConverter : IValueConverter
{
    /// <inheritdoc />
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is ViewModels.DialogKind kind)
        {
            return kind switch
            {
                ViewModels.DialogKind.Help        => PackIconMaterialKind.HelpCircleOutline,
                ViewModels.DialogKind.Information => PackIconMaterialKind.InformationOutline,
                ViewModels.DialogKind.Success     => PackIconMaterialKind.InformationOutline,
                ViewModels.DialogKind.Warning     => PackIconMaterialKind.AlertCircleOutline,
                ViewModels.DialogKind.Error       => PackIconMaterialKind.AlertOutline,
                _                      => PackIconMaterialKind.InformationOutline
            };
        }

        return PackIconMaterialKind.InformationOutline;
    }

    /// <inheritdoc />
    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return ViewModels.DialogKind.Information;
    }
}
